<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			const arr = [{ name: '张三1', age: 10 }, { name: '张三2', age: 20 }, { name: '张三3', age: 40 }, { name: '张三4', age: 40 }, { name: '张三5', age: 33 }, { name: '张三6', age: 2 }, ]
			// const max = Math.max.apply(Math, array.map(function(o) {
			// 	return o.age; // 需要比较的值
			// }))
			// const min = Math.min.apply(Math, array.map(function(o) {
			// 	return o.age; // 需要比较的值
			// }))
			// console.log(max,min)
			var max = arr[0].age;
			for (var i = 1; i < arr.length; i++) {
				max = max < arr[i].age ? arr[i].age : max;
			}
			
			var min = arr[0].age;
			for (var i = 1; i < arr.length; i++) {
				min = min > arr[i].age ? arr[i].age : min;
			}
			
			console.log(max,min,arr.filter(item=>item.age==max))
		</script>
	</body>
</html>
